﻿$(document).ready(function () {
    $('.cat-edit > .edit, .user-edit > .edit').click(function () {
        $(this).siblings('form, .orders-history').hide();
        $(this).siblings('form').toggle(200);
    });
    $('.user-edit > .show').click(function () {
        $(this).siblings('form, .orders-history').hide();
        $(this).siblings('.orders-history').toggle(200);
    });
    $('.cat-edit input[name=submit]').click(function () {
        var obj = $(this).siblings('input[name=name]');
        var regExp = /^[-a-z0-9A-Z_]{4,100}$/;
        var matches = regExp.test(obj.val());
        if (!matches) {
            obj.css({ backgroundColor: '#F9A7B0' });
        }
        return matches;
    });
    $('.delete-good').click(function () {
        return confirm('Are you sure?');
    });
});